<template>
  <div>
    <div class="container">
      <!--搜索-->
      <div v-show="seek">
        <div class="handle-box">
          <el-input v-model="select_word" placeholder="筛选关键词" class="handle-input mr10"
                    @keyup.enter.native="search">
            <i slot="prefix" class="el-input__icon el-icon-search"></i>
          </el-input>
          <el-select class="ipt1" v-model="sheng1" placeholder="省">
            <el-option
              v-for="item in provinces"
              :key="item.value"
              :label="item.label"
              :value="item">
            </el-option>
          </el-select>
          <el-select class="ipt1" v-model="doctorTitle" placeholder="医生职称">
            <el-option
              v-for="item in  doctorTitles"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <el-select class="ipt1" v-model="administrativeOffice" placeholder="科室">
            <el-option
              v-for="item in  administrativeOffices"
              :key="item.value"
              :label="item.label"
              :value="item">
            </el-option>
          </el-select>
          <el-button type="primary" icon="search" @click="search">搜索</el-button>
          <el-button type="success" size="small" @click="handleAdd">新增</el-button>
        </div>
        <div style="margin-top: 10px">
          <span style="font-weight: bold;font-size: 12px;">共<span style="color: red">{{nbr}}</span>条数据！</span>
        </div>
        <!--表格-->
        <el-table onselectstart="return false" :data="tableData" border style="width: 100%;margin-top: 20px">
          <el-table-column label="医生名字" prop="doctorName">
            <template slot-scope="scope">
              <div style="color: blue;cursor:pointer;" @click="openDetails(scope.row)">{{scope.row.doctorName}}</div>
            </template>
          </el-table-column>
          <el-table-column label="所在医院" prop="hospital"></el-table-column>
          <el-table-column label="医生职称" prop="doctorTitle"></el-table-column>
          <el-table-column label="医生科室" prop="department"></el-table-column>
          <el-table-column label="国籍" prop="country"></el-table-column>
          <el-table-column label="省" prop="province"></el-table-column>
          <el-table-column label="操作" width="230">
            <template slot-scope="scope">
              <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
              <el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div style="margin-left: 60%;" v-if="isRouterAlive">
          <paging :all="all" @returnValue="returnValue"></paging>
        </div>
      </div>
      <!--新增-->
      <div v-show="Added">
        <h3>医院信息</h3>
        <el-row :gutter="20">
          <el-col :span="12">
            <div class="interval">
              <span class="spn">医院名字:</span>
              <el-input class="ipt" v-model="hcoName" placeholder="请输入医院名称"></el-input>
              <el-button type="primary" icon="search" @click="search1">搜索</el-button>
            </div>
            <div class="interval">
              <span class="spn">显示名字:</span>
              <el-input class="ipt" :disabled="disabledInput" v-model="form.hospital" placeholder="请输入医院名称"></el-input>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="interval">
              <span class="spn">医院ID:</span>
              <el-input class="ipt" :disabled="disabledInput" v-model="form.hospitalId"
                        placeholder="请输入医院名称"></el-input>
            </div>
            <div class="interval">
              <span class="spn">医院等级:</span>
              <el-input class="ipt" :disabled="disabledInput" v-model="form.hospitalLevel"
                        placeholder="请输入医院名称"></el-input>
            </div>
          </el-col>
        </el-row>
        <h3>医生基本信息</h3>
        <el-row :gutter="20">
          <el-col :span="12">
            <div class="interval">
              <span class="spn">医生名字:</span>
              <el-input class="ipt" v-model="form.doctorName" placeholder="请输入医生名字"></el-input>
            </div>
            <div class="interval">
              <span class="spn">英文名字:</span>
              <el-input class="ipt" v-model="form.doctorEnName" placeholder="请输入英文名字"></el-input>
            </div>
            <div class="interval">
              <span class="spn">性别:</span>
              <el-select class="ipt" v-model="form.sex" placeholder="请输入性别">
                <el-option
                  v-for="item in sexs"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">国籍:</span>
              <el-input class="ipt" v-model="form.country" placeholder="请输入国籍"></el-input>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="interval">
              <span class="spn">省:</span>
              <el-select class="ipt" v-model="sheng" value-key="value" @change='Provinceer' placeholder="请输入医院所在省">
                <el-option
                  v-for="item in provinces"
                  :key="item.value"
                  :label="item.label"
                  :value="item">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">市:</span>
              <el-select class="ipt" v-model="shi" @change='cityer' placeholder="请输入医院所在市">
                <el-option
                  v-for="item in citys"
                  :key="item.value"
                  :label="item.label"
                  :value="item">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">区:</span>
              <el-select class="ipt" v-model="qu" placeholder="请输入医院所在区">
                <el-option
                  v-for="item in areas"
                  :key="item.value"
                  :label="item.label"
                  :value="item">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">电话:</span>
              <el-input class="ipt" v-model="form.phoneNumber" placeholder="请输入医生名字"></el-input>
            </div>
          </el-col>
        </el-row>
        <h3>医生详细信息</h3>
        <el-row :gutter="20">
          <el-col :span="12">
            <div class="interval">
              <span class="spn">是否激活:</span>
              <el-select class="ipt" v-model="form.isActive" placeholder="请输入">
                <el-option
                  v-for="item in Active"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">父科室:</span>
              <el-select class="ipt" value-key="value" v-model="fatherDepartment" @change='father' placeholder="请输入">
                <el-option
                  v-for="item in fatherDepartments"
                  :key="item.value"
                  :label="item.label"
                  :value="item">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">子科室:</span>
              <el-select class="ipt" v-model="sonDepartment" placeholder="请输入医院所在区">
                <el-option
                  v-for="item in sonDepartments"
                  :key="item.value"
                  :label="item.label"
                  :value="item">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">清洗后科室:</span>
              <el-input class="ipt" v-model="form.departmentClean" placeholder="请输入医生名字"></el-input>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="interval">
              <span class="spn">医生职称:</span>
              <el-select class="ipt" v-model="form.doctorTitle" placeholder="请输入医生职称">
                <el-option
                  v-for="item in  doctorTitles"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
            <div class="interval">
              <span class="spn">清洗后职称:</span>
              <el-input class="ipt" v-model="form.doctorTitleCleaned" placeholder="请输入医生名字"></el-input>
            </div>
            <div class="interval">
              <span class="spn">来源:</span>
              <el-input class="ipt" v-model="form.source" placeholder="请输入医生名字"></el-input>
            </div>
            <div class="interval">
              <span class="spn">网址:</span>
              <el-input class="ipt" v-model="form.website" placeholder="请输入医生名字"></el-input>
            </div>
          </el-col>
          <el-col :span="24">
            <div class="interval">
              <span class="spn" style="height: 100px;">个人专长:</span>
              <el-input type="textarea" :rows="5" class="ipt" style="width: 83%" v-model="form.personalExpertise"
                        placeholder=""></el-input>
            </div>
          </el-col>
        </el-row>
        <div class="but">
          <el-button type="primary" v-show="yesShow" @click="yes">确定</el-button>
          <el-button type="primary" v-show="yes1Show" @click="yes1">确定</el-button>
          <el-button type="danger" @click="abolish">取消</el-button>
        </div>
      </div>
      <!--选择医院-->
      <el-dialog
        title="提示"
        :visible.sync="dialogVisible"
        width="60%">
        <el-table :data="tableData1" border style="width: 100%;margin-top: 20px">
          <el-table-column label="" width="65">
            <template scope="scope">
              <el-radio :label="scope.row.id" v-model="templateRadio"
                        @change.native="getTemplateRow(scope.$index,scope.row)">&nbsp
              </el-radio>
            </template>
          </el-table-column>
          <el-table-column label="医院名称" prop="showName"></el-table-column>
          <el-table-column label="评级" prop="grade"></el-table-column>
          <el-table-column label="等级" prop="level"></el-table-column>
          <el-table-column label="省" prop="province"></el-table-column>
          <el-table-column label="市" prop="city"></el-table-column>
        </el-table>
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="ascertain">确 定</el-button>
  </span>
      </el-dialog>
      <!--预览医生信息-->
      <div v-show="preview">
        <!--基本信息-->
        <div>
          <el-row :gutter="20">
            <el-col :span="4">
              <div>
                <a href="javascript:;" class="person_portraitwr">
                  <img src="static/img/tuxiang.png" alt="">
                </a>
              </div>
            </el-col>
            <el-col :span="18">
              <div class="p_name">{{form.doctorName}}</div>
              <div class="p_volume">{{form.doctorTitleCleaned}}</div>
              <div class="p_affiliate">{{form.hospital}}</div>
              <div class="p_dengji">{{form.hospitalLevel}}</div>
              <div class="p_keshi">{{form.departmentClean}}</div>
              <div class="p_zhuanchang">{{form.personalExpertise}}</div>
            </el-col>
          </el-row>
        </div>
        <!--详细信息-->
        <div>
          <div @click="showIs" style="font-weight: 600;padding-top: 20px;display: inline-block">查看更多信息<i
            :class="{'el-icon-caret-bottom':isShow,'el-icon-caret-top':onShow}"></i></div>
          <div v-show="onShow">
            <ul class="p_ach_wr">
              <li class="p_ach_item">
                <div class="p_ach_type">省</div>
                <div class="p_ach_num">{{form.province}}</div>
              </li>
              <li class="p_ach_item">
                <div class="p_ach_type">市</div>
                <div class="p_ach_num">{{form.city}}</div>
              </li>
              <li class="p_ach_item">
                <div class="p_ach_type">父科室</div>
                <div class="p_ach_num">{{fatherDepartment}}</div>
              </li>
              <li class="p_ach_item">
                <div class="p_ach_type">子科室</div>
                <div class="p_ach_num">{{sonDepartment}}</div>
              </li>
              <li class="p_ach_item">
                <div class="p_ach_type">清洗后科室</div>
                <div class="p_ach_num">{{form.departmentClean}}</div>
              </li>
              <li class="p_ach_item">
                <div class="p_ach_type">是否激活</div>
                <div class="p_ach_num">
                  <span v-if="form.isActive == 1">是</span>
                  <span v-else>否</span>
                </div>
              </li>
              <li class="p_ach_item">
                <div class="p_ach_type">网址</div>
                <div class="p_ach_num">{{form.website}}</div>
              </li>
              <li class="p_ach_item">
                <div class="p_ach_type">来源</div>
                <div class="p_ach_num">{{form.source}}</div>
              </li>
            </ul>
          </div>
        </div>
        <!--环形-->
        <div v-if="isRouterAlive">
          <el-row :gutter="20">
            <el-col :span="4">
              <pie :AnnularFigure="AnnularFigure1" :subtext="subtext1"></pie>
            </el-col>
            <el-col :span="4">
              <pie :AnnularFigure="AnnularFigure2" :subtext="subtext2"></pie>
            </el-col>
            <el-col :span="4">
              <pie :AnnularFigure="AnnularFigure3" :subtext="subtext3"></pie>
            </el-col>
            <el-col :span="4">
              <pie :AnnularFigure="AnnularFigure4" :subtext="subtext4"></pie>
            </el-col>
            <el-col :span="4">
              <!--              <pie :AnnularFigure="AnnularFigure1" :subtext="subtext5"></pie>-->
            </el-col>
          </el-row>
        </div>
        <!--tabs页-->
        <div>
          <el-tabs type="card" v-model="activeName">
            <!--论文-->
            <el-tab-pane label="论文" name="paper">
              <el-table onselectstart="return false" :data="paper" border style="width: 100%;margin-top: 20px">
                <el-table-column label="时间" prop="year" width="60" align="center"></el-table-column>
                <el-table-column label="论文名">
                  <template slot-scope="scope">
                    <a :href="scope.row.url"
                       target="_blank"
                       class="buttonText">{{scope.row.title}}</a>
                  </template>
                </el-table-column>
                <el-table-column label="作者" prop="hcpName" width="100" align="center"></el-table-column>
                <el-table-column label="关键字">
                  <template slot-scope="scope">
                    <span v-for="keyWords in scope.row.keyWords">{{keyWords}}，</span>
                  </template>
                </el-table-column>
              </el-table>
              <paging :all="all1" @returnValue="returnValue1" style="margin-left: 60%;"></paging>
            </el-tab-pane>
            <!--会议-->
            <el-tab-pane label="会议" name="meeting">
              <el-table onselectstart="return false" :data="meeting" border style="width: 100%;margin-top: 20px">
                <el-table-column label="会议" prop="meeting_name"></el-table-column>
                <el-table-column label="地点" prop="meeting_address"></el-table-column>
                <el-table-column label="时间" prop="meeting_date"></el-table-column>
              </el-table>
              <paging :all="all2" @returnValue="returnValue2" style="margin-left: 60%;"></paging>
            </el-tab-pane>
            <!--协会任职-->
            <el-tab-pane label="协会任职" name="association">
              <el-table onselectstart="return false" :data="association" border style="width: 100%;margin-top: 20px">
                <el-table-column label="协会" prop="institution_name"></el-table-column>
                <el-table-column label="职位" prop="job_name"></el-table-column>
                <el-table-column label="协会级别" prop="institution_level"></el-table-column>
              </el-table>
              <paging :all="all3" @returnValue="returnValue3" style="margin-left: 60%;"></paging>
            </el-tab-pane>
            <!--获奖-->
            <el-tab-pane label="获奖" name="award">
              <el-table onselectstart="return false" :data="award" border style="width: 100%;margin-top: 20px">
                <el-table-column label="时间" prop="time" align="center"></el-table-column>
                <el-table-column label="获奖" prop="award_name" align="center"></el-table-column>
                <el-table-column label="奖项级别" prop="award_level" align="center"></el-table-column>
              </el-table>
              <paging :all="all4" @returnValue="returnValue4" style="margin-left: 60%;"></paging>
            </el-tab-pane>
            <!--杂志任职-->
            <el-tab-pane label="杂志任职" name="magazine">
              <el-table onselectstart="return false" :data="magazine" border style="width: 100%;margin-top: 20px">
                <el-table-column label="杂志" prop="institution_name"></el-table-column>
                <el-table-column label="任职" prop="job_name"></el-table-column>
                <el-table-column label="杂志级别" prop="institution_level"></el-table-column>
              </el-table>
              <paging :all="all5" @returnValue="returnValue5" style="margin-left: 60%;"></paging>
            </el-tab-pane>
            <!--临床-->
            <el-tab-pane label="临床" name=" clinic">
              <el-table onselectstart="return false" :data="clinic" border style="width: 100%;margin-top: 20px">
                <el-table-column label="状态" prop="status"></el-table-column>
                <el-table-column label="药物名字" prop="drugName"></el-table-column>
                <el-table-column label="试验类型" prop="trialType"></el-table-column>
                <el-table-column label="研究疾病" prop="studyDisease"></el-table-column>
                <el-table-column label="regist标题" prop="registTitle"></el-table-column>
              </el-table>
              <paging :all="all6" @returnValue="returnValue6" style="margin-left: 60%;"></paging>
            </el-tab-pane>
          </el-tabs>
        </div>
        <!--返回-->
        <el-button type="success" @click="preview = false,seek = true">返回</el-button>
      </div>
      <!-- 删除提示框 -->
      <el-dialog title="提示" :visible.sync="delVisible" width="300px" center>
        <div class="del-dialog-cnt">删除不可恢复，是否确定删除？</div>
        <span slot="footer" class="dialog-footer">
                <el-button @click="delVisible = false">取 消</el-button>
                <el-button type="primary" @click="deleteRow">确 定</el-button>
            </span>
      </el-dialog>
      <!--没有搜索到数据-->
      <el-dialog
        :visible.sync="centerDialogVisible"
        width="30%"
        center>
        <div style="text-align: center">
        <span
          style='display: inline-block;background: url("../../../static/img/weep.png") no-repeat;background-size:100%;width: 50px;height: 50px;vertical-align: middle;'></span>
          <span style="display:inline-block;font-size: 20px;font-weight: bold">没有搜索到数据!</span>
        </div>
      </el-dialog>
    </div>
    <div class="container" v-show="preview">
      <span style="text-align: center;display: block">
        <el-button-group>
          <el-button type="primary" @click="wall = true,time = false">词墙</el-button>
          <el-button type="primary" @click="wall = false,time = true">历年出现次数</el-button>
        </el-button-group>
      </span>
      <!--词墙-->
      <div style="text-align: center" v-show="wall" v-if="isRouterAlive">
        <cloudWall :value="words"></cloudWall>
      </div>
      <!--历年出现次数-->
      <div style="text-align: center;" v-show="time" v-if="isRouterAlive">
        <year :series="series"></year>
      </div>
    </div>
  </div>

</template>

<script>
  import paging from '../element/page';
  import pie from '../element/pie';
  import year from '../element/year';
  import cloudWall from '../element/cloudWall';

  export default {
    components: {paging, pie, year, cloudWall},
    data() {
      return {
        centerDialogVisible: false,
        /*词墙*/
        words: [],
        wall: true,
        time: false,
        /*历年出现次数*/
        series: [],
        /*关键词*/
        wordsKey: [],
        /*数*/
        nbr: 0,
        /*刷新组件*/
        isRouterAlive: true,
        /*URL*/
        URL: this.$com.Url,
        /*选择医院弹出框*/
        dialogVisible: false,
        templateRadio: '',
        /*预览医生信息*/
        preview: false,
        Obj: {
          hcpId: '',
          hcpName: ''
        },
        /*预览医生信息tabs页*/
        activeName: 'paper',
        /*新增*/
        Added: false,
        yesShow: false,
        yes1Show: false,
        /*删除*/
        delVisible: false,
        /*医院信息*/
        hospital: '',
        disabledInput: true,
        /*搜索*/
        select_word: '',
        hcoName: '',
        seek: true,
        doctorTitle: '',
        sheng1: '',
        administrativeOffice: '',
        administrativeOffices: [],
        /*数据*/
        tableData: [],
        tableData1: [],
        form: {
          area: "",
          city: "",
          country: "中国",
          department: "",
          departmentClean: "",
          doctorEnName: "",
          doctorName: "",
          doctorTitle: "",
          doctorTitleCleaned: "",
          hospital: "",
          hospitalId: "",
          hospitalLevel: "",
          isActive: 1,
          personalExpertise: "",
          phoneNumber: "",
          province: "",
          sex: 0,
          source: "",
          website: ""
        },
        /*性别*/
        sexs: [
          {
            value: 0,
            label: '未知'
          }, {
            value: 1,
            label: '男'
          }, {
            value: 2,
            label: '女'
          }],
        /*医生职称*/
        doctorTitles: [
          {
            value: '无',
            label: '无'
          },
          {
            value: '住院医师',
            label: '住院医师'
          }, {
            value: '主治医师',
            label: '主治医师'
          }, {
            value: '副主任医师',
            label: '副主任医师',
          }, {
            value: '主任医师',
            label: '主任医师'
          }],
        /*是否激活*/
        Active: [
          {
            value: 1,
            label: '是'
          }, {
            value: 0,
            label: '否'
          }],
        /*省*/
        provinces: [],
        sheng: '',
        /*市*/
        citys: [],
        shi: '',
        /*区*/
        areas: [],
        qu: '',
        /*父科室*/
        fatherDepartments: [],
        fatherDepartment: '',
        /*子科室*/
        sonDepartments: [],
        sonDepartment: '',
        data: {},
        /*分页*/
        all: 1,
        all1: 1,
        all2: 1,
        all3: 1,
        all4: 1,
        all5: 1,
        all6: 1,
        /*多条件筛选*/
        screen: {
          hcpName: '',
          provinceId: '',
          provinceName: '',
          hcpTitle: '',
          deptId: '',
          deptName: '',
        },
        /*医生详情页中的详情数据*/
        isShow: true,
        onShow: false,
        /*tabs页*/
        paper: [],
        meeting: [],
        association: [],
        award: [],
        magazine: [],
        clinic: [],
        /*环状图*/
        AnnularFigure1: {},
        AnnularFigure2: {},
        AnnularFigure3: {},
        AnnularFigure4: {},
        subtext1: '论文',
        subtext2: '会议',
        subtext3: '协会任职',
        subtext4: '获奖',
        subtext5: '杂志任职',
      }
    },
    watch: {
      sheng1() {
        if (this.sheng1.label == '无') {
          this.sheng1 = ''
        }
      },
      doctorTitle() {
        if (this.doctorTitle == '无') {
          this.doctorTitle = ''
        }
      },
      administrativeOffice() {
        if (this.administrativeOffice.label == '无') {
          this.administrativeOffice = ''
        }
      }
    },
    created() {
      /*获取省*/
      this.province(this.URL, '/region/AllProvince');
      /*获取父科室*/
      this.fatherDepartmenter(this.URL, '/standard/department/parentDepartment');
      /*获取子科室*/
      this.administrativeOfficeFun(this.$com.Url + '/standard/department/AllSon');
    },
    methods: {
      /*刷新组件*/
      reload() {
        this.isRouterAlive = false;
        this.$nextTick(() => (this.isRouterAlive = true))
      },
      /*分页*/
      returnValue(data) {
        this.searchPOST(this.URL + '/huimei/hcp/hcp_adv_query?page=' + data, this.screen)
      },
      returnValue1(data) {
        this.openDetailsPOST(this.$com.ZRUrl + '/hcpmdm/hcp_article?page=', data, this.Obj)
      },
      returnValue2(data) {
        this.meetingApi(this.$com.ZRUrl + '/meetingsmdm/hcp_meetingsmdm/' + this.Obj.hcpId + '/' + data);
      },
      returnValue3(data) {
        this.associationApi(this.$com.ZRUrl + '/institutionalmdm/hcp_institutionalmdm/' + this.Obj.hcpId + '/1' + '/' + data);
      },
      returnValue4(data) {
        this.awardApi(this.$com.ZRUrl + '/awardmdm/hcp_awardmdm/' + this.Obj.hcpId + '/' + data);
      },
      returnValue5(data) {
        this.magazineApi(this.$com.ZRUrl + '/institutionalmdm/hcp_institutionalmdm/' + this.Obj.hcpId + '/0' + '/' + data);
      },
      returnValue6(data) {
        this.clinicApi(this.$com.ZRUrl + '/clinicalmdm/hcp_clinicalmdm/' + this.Obj.hcpId + '/' + data);
      },
      /*预览医生信息*/
      openDetails(row) {
        this.preview = true;
        this.seek = false;
        this.form.id = row.id;
        this.form.doctorId = row.doctorId;
        this.hcoName = row.hospital;
        this.form.hospital = row.hospital;
        this.form.hospitalId = row.hospitalId;
        this.form.hospitalLevel = row.hospitalLevel;
        this.form.doctorName = row.doctorName;
        this.form.doctorEnName = row.doctorEnName;
        this.form.sex = Number(row.sex);
        this.form.country = row.country;
        this.sheng = row.province;
        this.form.province = row.province;
        this.shi = row.city;
        this.form.city = row.city;
        this.qu = row.area;
        this.form.area = row.area;
        this.form.phoneNumber = row.phoneNumber;
        this.form.isActive = Number(row.isActive);
        this.sonDepartment = row.department;
        this.form.department = row.department;
        this.form.departmentClean = row.departmentClean;
        this.fatherDepartment = row.departmentClean;
        this.form.doctorTitle = row.doctorTitle;
        this.form.doctorTitleCleaned = row.doctorTitleCleaned;
        this.form.source = row.source;
        this.form.website = row.website;
        this.form.personalExpertise = row.personalExpertise;

        this.Obj.hcpId = row.doctorId;
        this.Obj.hcpName = row.doctorName;
        /*词墙*/
        this.wordWall(this.$com.ZRUrl + '/cnpapermdm/keyword_wall/' + row.doctorId);
        /*历年出现次数*/
        this.timeApi(this.$com.ZRUrl + '/cnpapermdm/keyword_wall_by_keyword_year/' + row.doctorId);
        /*医生论文*/
        this.openDetailsPOST(this.$com.ZRUrl + '/hcpmdm/hcp_article?page=', 1, this.Obj);
        /*医生论文圈*/
        this.paperLoop(this.$com.ZRUrl + '/cnpapermdm/journal_buckets/' + row.doctorId);
        /*会议*/
        this.meetingApi(this.$com.ZRUrl + '/meetingsmdm/hcp_meetingsmdm/' + row.doctorId + '/1');
        this.meetingCircleApi(this.$com.ZRUrl + '/meetingsmdm/meetings_buckets/' + row.doctorId);
        /*杂志*/
        this.magazineApi(this.$com.ZRUrl + '/institutionalmdm/hcp_institutionalmdm/' + row.doctorId + '/0' + '/1');
        /*协会*/
        this.associationApi(this.$com.ZRUrl + '/institutionalmdm/hcp_institutionalmdm/' + row.doctorId + '/1' + '/1');
        this.associationCircleApi(this.$com.ZRUrl + '/institutionalmdm/institutional_buckets/' + row.doctorId + '/1');
        /*获奖*/
        this.awardApi(this.$com.ZRUrl + '/awardmdm/hcp_awardmdm/' + row.doctorId + '/1');
        this.awardCircleApi(this.$com.ZRUrl + '/awardmdm/award_buckets/' + row.doctorId);
        /*临床*/
        this.clinicApi(this.$com.ZRUrl + '/clinicalmdm/hcp_clinicalmdm/' + row.doctorId + '/1');
      },
      /*医生论文*/
      openDetailsPOST(URL, page, Obj) {
        this.$axios({
          method: 'POST',
          headers: {'Content-Type': 'application/json;charset=UTF-8'},
          url: URL + page,
          data: JSON.stringify(Obj),
        }).then((res) => {
          if (res.data.result.length > 0) {
            this.reload();
            if (res.data.result[0].total % 5 > 0) {
              this.all1 = parseInt(res.data.result[0].total / 5) + 1
            } else {
              this.all1 = parseInt(res.data.result[0].total / 5)
            }
            this.paper = res.data.result;
            this.$message.success('搜索成功！');
          } else {
            this.paper = [];
            this.centerDialogVisible = true;
            setTimeout(() => {
              this.centerDialogVisible = false;
            }, 1500);
          }
        })
      },
      paperLoop(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          if (res.data.result) {
            this.reload();
            this.AnnularFigure1 = res.data.result;
          }
        })
      },
      /*会议*/
      meetingApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          if (res.data.result.length > 0) {
            if (res.data.result[0].total % 5 > 0) {
              this.all2 = parseInt(res.data.result[0].total / 5) + 1
            } else {
              this.all2 = parseInt(res.data.result[0].total / 5)
            }
            this.meeting = res.data.result;
          } else {
            this.meeting = []
          }
        })
      },
      meetingCircleApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          this.reload();
          this.AnnularFigure2.total = res.data.result;
        })
      },
      /*杂志*/
      magazineApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          if (res.data.result.length > 0) {
            if (res.data.result[0].total % 5 > 0) {
              this.all5 = parseInt(res.data.result[0].total / 5) + 1
            } else {
              this.all5 = parseInt(res.data.result[0].total / 5)
            }
            this.magazine = res.data.result;
          } else {
            this.magazine = []
          }
        })
      },
      /*协会*/
      associationApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          if (res.data.result.length > 0) {
            if (res.data.result[0].total % 5 > 0) {
              this.all3 = parseInt(res.data.result[0].total / 5) + 1
            } else {
              this.all3 = parseInt(res.data.result[0].total / 5)
            }
            this.association = res.data.result;
          } else {
            this.association = []
          }
        })
      },
      associationCircleApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          this.reload();
          this.AnnularFigure3.total = res.data.result;
        })
      },
      /*奖*/
      awardApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          if (res.data.result.length > 0) {
            if (res.data.result[0].total % 5 > 0) {
              this.all4 = parseInt(res.data.result[0].total / 5) + 1
            } else {
              this.all4 = parseInt(res.data.result[0].total / 5)
            }
            this.award = res.data.result;
          } else {
            this.award = []
          }
        })
      },
      awardCircleApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          this.reload();
          this.AnnularFigure4.total = res.data.result;
        })
      },
      /*临床*/
      clinicApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          if (res.data.result.length > 0) {
            this.reload();
            if (res.data.result[0].total % 5 > 0) {
              this.all6 = parseInt(res.data.result[0].total / 5) + 1
            } else {
              this.all6 = parseInt(res.data.result[0].total / 5)
            }
            this.clinic = res.data.result;
          } else {
            this.clinic = []
          }
        })
      },
      /*词墙*/
      wordWall(Url) {
        let _this = this;
        this.$axios.get(Url)
          .then((response) => {
            let array = [];
            this.wordsKey = [];
            for (let data of response.data.result) {
              let a = {
                name: data.key,
                value: data.count.value
              };
              array.push(a);
              if (data.count.value >= 10) {
                this.wordsKey.push(data.key)
              }
            }
            _this.words = array;
          })
          .catch((error) => {
            console.log(error);
          });
      },
      /*历年出现次数*/
      timeApi(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          if (res.data.result) {
            const series = [];
            for (let Key of this.wordsKey) {
              for (let keys of res.data.result) {
                if (keys.key == Key) {
                  let obj = {
                    name: keys.key,
                    type: "bar",
                    stack: "总量",
                    barMaxWidth: 35,
                    barGap: "10%",
                    itemStyle: {
                      normal: {
                        label: {
                          formatter: function (p) {
                            return p.value > 0 ? (p.value) : '';
                          }
                        }
                      }
                    },
                    data: [],
                  };
                  let jsonObj = [];
                  for (let buckets of keys.year.buckets) {
                    for (let year of ['2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010',]) {
                      if (buckets.key == year) {
                        jsonObj[year] = buckets.count.value
                      } else {
                        jsonObj[year] = 0
                      }
                    }
                  }
                  obj.data.push(jsonObj['2019']);
                  obj.data.push(jsonObj['2018']);
                  obj.data.push(jsonObj['2017']);
                  obj.data.push(jsonObj['2016']);
                  obj.data.push(jsonObj['2015']);
                  obj.data.push(jsonObj['2014']);
                  obj.data.push(jsonObj['2013']);
                  obj.data.push(jsonObj['2012']);
                  obj.data.push(jsonObj['2011']);
                  obj.data.push(jsonObj['2010']);
                  series.push(obj);
                }
              }
            }
            this.series = series;
          }
        })
      },
      /*选择医院*/
      getTemplateRow(index, row) {
        this.hospital = row
      },
      ascertain() {
        if (this.hospital != '') {
          this.dialogVisible = false;
          this.form.hospital = this.hospital.showName;
          this.form.hospitalId = this.hospital.hospitalUid;
          this.form.hospitalLevel = this.hospital.hospitalLevelFull;
        } else {
          this.$message.warning('请选择医院！');
        }
      },
      /*搜索*/
      search() {
        if (this.select_word != '' || this.sheng1 != '' || this.doctorTitle != '' || this.administrativeOffice != '') {
          if (this.select_word != '') {
            this.screen.hcpName = this.select_word
          } else {
            this.screen.hcpName = ''
          }
          if (this.sheng1 != '') {
            this.screen.provinceId = this.sheng1.value;
            this.screen.provinceName = this.sheng1.label
          } else {
            this.screen.provinceId = '';
            this.screen.provinceName = ''
          }
          if (this.doctorTitle != '') {
            this.screen.hcpTitle = this.doctorTitle;
          } else {
            this.screen.hcpTitle = '';
          }
          if (this.administrativeOffice != '') {
            this.screen.deptId = this.administrativeOffice.value;
            this.screen.deptName = this.administrativeOffice.label;
          } else {
            this.screen.deptId = '';
            this.screen.deptName = '';
          }
          this.reload();
          this.searchPOST(this.URL + '/huimei/hcp/hcp_adv_query?page=' + 1, this.screen)
        } else {
          this.tableData = [];
          this.$message.warning('不能为空！');
        }
      },
      searchPOST(URL, obj) {
        this.$axios({
          method: 'POST',
          headers: {'Content-Type': 'application/json;charset=UTF-8'},
          url: URL,
          data: JSON.stringify(obj),
        }).then((res) => {
          if (res.data.data.result.length > 0) {
            this.nbr = res.data.data.result[0].total;
            if (res.data.data.result[0].total % 20 > 0) {
              this.all = parseInt(res.data.data.result[0].total / 20) + 1
            } else {
              this.all = parseInt(res.data.data.result[0].total / 20)
            }
            this.tableData = res.data.data.result;
            this.$message.success('搜索成功！');
          } else {
            this.tableData = [];
            this.centerDialogVisible = true;
            setTimeout(() => {
              this.centerDialogVisible = false;
            }, 1500);
          }
        })
      },
      search1() {
        if (this.hcoName != '') {
          this.dialogVisible = true;
          this.$axios({
            method: 'GET',
            url: this.URL + '/huimei/hcp/selectDoctorByHoc/' + this.hcoName,
          }).then((res) => {
            this.tableData1 = res.data.data.result
          })
        } else {
          this.$message.warning('医院名字不能为空！');
        }
      },
      /*新增*/
      handleAdd() {
        this.seek = false;
        this.Added = true;
        this.yesShow = true;
      },
      /*确认新增*/
      yes() {
        if (this.hcoName == '') {
          this.$message.warning('医院名称不能为空！');
        } else if (this.form.hospitalId == '') {
          this.$message.warning('搜索医院，选择医院信息！');
        } else {
          if (this.sheng != '') {
            this.form.province = this.sheng.label;
            /*            this.form.provinceId = this.sheng.value.toString();*/
          }
          if (this.shi != '') {
            this.form.city = this.shi.label;
          }
          if (this.qu != '') {
            this.form.area = this.qu.label
          }
          if (this.fatherDepartment != '') {
            this.form.departmentClean = this.fatherDepartment.label;
            this.form.departmentCleanId = this.fatherDepartment.value;
          }
          if (this.sonDepartment != '') {
            this.form.department = this.sonDepartment.label;
            this.form.departmentId = this.sonDepartment.value;
          }
          if (this.form.isActive == 0) {
            this.form.isActive = '0'
          }
          if (this.form.isActive == 1) {
            this.form.isActive = '1'
          }
          if (this.form.sex == 0) {
            this.form.sex = '0'
          }
          if (this.form.sex == 1) {
            this.form.sex = '1'
          }
          if (this.form.sex == 2) {
            this.form.sex = '2'
          }
          this.POST(this.URL, '/huimei/hcp/add', '添加')
        }
      },
      /*取消*/
      abolish() {
        this.$router.go(0)
      },
      /*获取省*/
      province(Url, Port) {
        this.$axios({
          method: 'GET',
          url: Url + Port,
        }).then((res) => {
          let _this = this;
          _this.provinces.push({
            value: '',
            label: '无'
          });
          for (let data of res.data.data) {
            let obj = {
              value: data.id,
              label: data.name
            };
            _this.provinces.push(obj)
          }
        })
      },
      Provinceer() {
        this.citys = [];
        this.shi = '';
        this.qu = '';
        this.city(this.URL, '/region/AllCity/' + this.sheng.value);
      },
      /*获取市*/
      city(Url, Port) {
        this.$axios({
          method: 'GET',
          url: Url + Port,
        }).then((res) => {
          let _this = this;
          for (let data of res.data.data) {
            let obj = {
              value: data.id,
              label: data.name
            };
            _this.citys.push(obj)
          }
        })
      },
      cityer() {
        this.areas = [];
        this.qu = '';
        this.area(this.URL, '/region/AllCity/' + this.shi.value);
      },
      /*获取区*/
      area(Url, Port) {
        this.$axios({
          method: 'GET',
          url: Url + Port,
        }).then((res) => {
          let _this = this;
          for (let data of res.data.data) {
            let obj = {
              value: data.id,
              label: data.name
            };
            _this.areas.push(obj)
          }
        })
      },
      /*父科室*/
      fatherDepartmenter(Url, Port) {
        this.$axios({
          method: 'GET',
          url: Url + Port,
        }).then((res) => {
          let _this = this;
          for (let data of res.data.data) {
            let obj = {
              value: data.fatherDeptId,
              label: data.fatherDeptName
            };
            _this.fatherDepartments.push(obj)
          }
        })
      },
      father() {
        this.sonDepartments = [];
        this.sonDepartmenter(this.URL, '/standard/department/partDepartment/' + this.fatherDepartment.value);
      },
      /*子科室*/
      sonDepartmenter(Url, Port) {
        this.$axios({
          method: 'GET',
          url: Url + Port,
        }).then((res) => {
          let _this = this;
          for (let data of res.data.data) {
            let obj = {
              value: data.sonDeptId,
              label: data.sonDeptName,
            };
            _this.sonDepartments.push(obj)
          }
        })
      },
      administrativeOfficeFun(Url) {
        this.$axios({
          method: 'GET',
          url: Url,
        }).then((res) => {
          let _this = this;
          _this.administrativeOffices.push({
            value: '',
            label: '无'
          });
          for (let data of res.data.data) {
            if (data.sonDeptName) {
              let obj = {
                value: data.sonDeptId,
                label: data.sonDeptName,
              };
              _this.administrativeOffices.push(obj)
            }
          }
        })
      },
      /*编辑*/
      handleEdit(index, row) {
        this.seek = false;
        this.Added = true;
        this.yes1Show = true;
        this.form.id = row.id;
        this.form.doctorId = row.doctorId;
        this.hcoName = row.hospital;
        this.form.hospital = row.hospital;
        this.form.hospitalId = row.hospitalId;
        this.form.hospitalLevel = row.hospitalLevel;
        this.form.doctorName = row.doctorName;
        this.form.doctorEnName = row.doctorEnName;
        this.form.sex = Number(row.sex);
        this.form.country = row.country;
        this.sheng = row.province;
        this.form.province = row.province;
        this.shi = row.city;
        this.form.city = row.city;
        this.qu = row.area;
        this.form.area = row.area;
        this.form.phoneNumber = row.phoneNumber;
        this.form.isActive = Number(row.isActive);
        this.sonDepartment = row.department;
        this.form.department = row.department;
        this.form.departmentClean = row.departmentClean;
        this.form.doctorTitle = row.doctorTitle;
        this.form.doctorTitleCleaned = row.doctorTitleCleaned;
        this.form.source = row.source;
        this.form.website = row.website;
        this.form.personalExpertise = row.personalExpertise;
      },
      /*编辑确定*/
      yes1() {
        this.POST(this.URL, '/huimei/hcp/update', '修改');
      },
      /*删除处理*/
      handleDelete(index, row) {
        this.data.id = row.id;
        this.data.isActive = '0';
        this.data.hospitalUid = row.doctorId;
        this.idx = index;
        this.delVisible = true;
      },
      /*确定删除*/
      deleteRow() {
        this.tableData.splice(this.idx, 1);
        this.$axios({
          method: 'POST',
          headers: {'Content-Type': 'application/json;charset=UTF-8'},
          url: this.URL + '/huimei/hcp/delete',
          data: JSON.stringify(this.data),
        }).then((res) => {
          if (res.data.code == 200) {
            this.delVisible = false;
            this.$message.success('删除成功');
          }
        })
      },
      /*POST请求*/
      POST(Url, Port, message) {
        this.$axios({
          method: 'POST',
          headers: {'Content-Type': 'application/json;charset=UTF-8'},
          url: Url + Port,
          data: JSON.stringify(this.form),
        }).then((res) => {
          if (res.data.code == 200) {
            this.$message({
              message: '恭喜，' + message + '成功!',
              type: 'success'
            });
            setTimeout(() => {
              this.$router.go(0)
            }, 10)
          }
        })
      },
      showIs() {
        this.isShow = !this.isShow;
        this.onShow = !this.onShow
      },
    }
  }
</script>

<style scoped>
  .container {
    padding: 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
  }

  .interval {
    padding-bottom: 10px;
  }

  .spn {
    display: inline-block;
    width: 90px;
    font-weight: bold;
    color: #909399;
    font-size: 15px;
    text-align: right;
  }

  .spn1 {
    font-weight: bold;
    color: #909399;
    font-size: 16px;
    padding-left: 10px;
  }

  .ipt {
    display: inline-block;
    width: 280px;
  }

  .ipt1 {
    display: inline-block;
    width: 100px;
  }

  .handle-input {
    width: 200px;
    display: inline-block;
  }

  .del-dialog-cnt {
    font-size: 16px;
    text-align: center
  }

  /*医生基本信息*/
  .person_portraitwr {
    display: inline-block;
    width: 112px;
    height: 112px;
    border: 6px solid #F0F0F0;
    overflow: hidden;
    border-radius: 50%;
  }

  .p_name {
    font-size: 28px;
    color: #333;
    display: inline-block;
    font-weight: bold;
  }

  .p_volume {
    font-size: 14px;
    color: #999;
    margin-top: 25px;
    margin-left: 15px;
    display: inline-block;
    font-weight: 600;
  }

  .p_affiliate {
    margin-top: 6px;
    font-size: 15px;
    font-weight: 600;
  }

  .p_dengji {
    font-size: 14px;
    margin-top: 6px;
    display: inline-block;
    font-weight: 600;
  }

  .p_keshi {
    font-size: 14px;
    margin-top: 6px;
    margin-left: 15px;
    display: inline-block;
    font-weight: 600;
  }

  .p_zhuanchang {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
  }

  .p_ach_wr {
    overflow: hidden;
    margin-left: -50px;
  }

  .p_ach_item {
    float: left;
    border-right: 1px solid #efefef;
    padding: 0 10px;
    font-size: 20px;
    list-style: none;
    text-align: center;
  }

  .p_ach_type {
    color: #000;
    font-weight: 600;
    font-size: 15px;
  }

  .p_ach_num {
    color: #999;
    font-weight: 600;
    font-size: 13px;
  }
</style>
